<%@ page import="sun.misc.BASE64Decoder" %>
<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="java.util.Enumeration" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
    /*response.setCharacterEncoding("utf-8");
    request.setCharacterEncoding("utf-8");
    String auth = request.getHeader("Authorization");
    if(StringUtils.isNotEmpty(auth)){
        BASE64Decoder decoder = new BASE64Decoder();
        auth = auth.substring(6, auth.length());

        byte[] b = decoder.decodeBuffer(auth);
        String s = new String(b,"utf-8");
        out.println(s);
        String name=s.split(":")[0];
        String pass=s.split(":")[1];
        if("xx".equals(name) && "xx".equals(pass)){
            out.println("ok");
            return;
        }
    }
    response.setStatus(401);
    response.setHeader("Cache-Control", "no-store");
    response.setHeader("WWW-authenticate", "Basic Realm=\"test\"");*/

    Cookie[] cookies = request.getCookies();
    for(Cookie cookie :cookies){
        out.println(JSONObject.toJSONString(cookie)+"<br/>");
    }
out.println("<br/>-------------------<br/>");
    Enumeration  headerNames =request.getHeaderNames();
    while(headerNames.hasMoreElements()){
        String key=(String)headerNames.nextElement();
        out.println(key+" = "+request.getHeader(key)+"<br/>");
    }

%>